/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Issam
 */
@Entity
@Table(name = "HISTORIQUE_ACTION", catalog = "", schema = "NETTRADING")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HistoriqueAction.findAll", query = "SELECT h FROM HistoriqueAction h"),
    @NamedQuery(name = "HistoriqueAction.findByIdHistAction", query = "SELECT h FROM HistoriqueAction h WHERE h.idHistAction = :idHistAction"),
    @NamedQuery(name = "HistoriqueAction.findByDate", query = "SELECT h FROM HistoriqueAction h WHERE h.date = :date"),
    @NamedQuery(name = "HistoriqueAction.findByValeur", query = "SELECT h FROM HistoriqueAction h WHERE h.valeur = :valeur")})
public class HistoriqueAction implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_HIST_ACTION", nullable = false)
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Integer idHistAction;
    @Basic(optional = false)
    @Column(name = "DATE_HIST_ACT", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "VALEUR", nullable = false, precision = 7, scale = 3)
    private BigDecimal valeur;
    @JoinColumn(name = "NUM_ACTION", referencedColumnName = "NUM_ACTION", nullable = false)
    @ManyToOne(optional = false)
    private Action numAction;

    public HistoriqueAction() {
    }

    public HistoriqueAction(Integer idHistAction) {
        this.idHistAction = idHistAction;
    }

    public HistoriqueAction(Integer idHistAction, Date date, BigDecimal valeur) {
        this.idHistAction = idHistAction;
        this.date = date;
        this.valeur = valeur;
    }

    public Integer getIdHistAction() {
        return idHistAction;
    }

    public void setIdHistAction(Integer idHistAction) {
        this.idHistAction = idHistAction;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public BigDecimal getValeur() {
        return valeur;
    }

    public void setValeur(BigDecimal valeur) {
        this.valeur = valeur;
    }

    public Action getNumAction() {
        return numAction;
    }

    public void setNumAction(Action numAction) {
        this.numAction = numAction;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHistAction != null ? idHistAction.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HistoriqueAction)) {
            return false;
        }
        HistoriqueAction other = (HistoriqueAction) object;
        if ((this.idHistAction == null && other.idHistAction != null) || (this.idHistAction != null && !this.idHistAction.equals(other.idHistAction))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "test.entities.HistoriqueAction[ idHistAction=" + idHistAction + " ]";
    }
    
}
